<template>
  <div class="example">
    <h1>example : {{ props.msg }} - {{ msg }} - {{ mul }}</h1>
    <div>
      <el-button type="primary" @click="asd">btn 1</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import type { Student } from '@/types'

// ts写法
const props = withDefaults(
  defineProps<{
    msg?: string // 是否必传
  }>(),
  {
    msg: '默认值'
  }
)
let emit = defineEmits(['qwe']) //如果用的setup函数则是用cotext.emit去使用

const qwe = 'qweqweqweqweqweqweqwe'

let mul = computed(() => {
  return qwe.substring(0, 3)
})

const asd = () => {
  emit('qwe', 11, 22)
  console.debug()
  const student: Student = {
    name: ''
  }
  student.age
  return ''
}

defineExpose({
  asd
})
</script>

<style scoped lang="scss">
.example {
  width: 100%;
  height: 100%;
}
</style>
